package b.p.b;

import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.LayoutParams;
import androidx.recyclerview.widget.RecyclerView.s;
import androidx.recyclerview.widget.RecyclerView.z;
import b.p.b.a.a;
import b.p.b.a.b;

/* compiled from: RecyclerView */
public class b0 implements a {
    public final /* synthetic */ RecyclerView a;

    public b0(RecyclerView recyclerView) {
        this.a = recyclerView;
    }

    public void a(b bVar) {
        int i = bVar.a;
        RecyclerView recyclerView;
        if (i == 1) {
            recyclerView = this.a;
            recyclerView.m.p0(recyclerView, bVar.b, bVar.d);
        } else if (i == 2) {
            recyclerView = this.a;
            recyclerView.m.s0(recyclerView, bVar.b, bVar.d);
        } else if (i == 4) {
            recyclerView = this.a;
            recyclerView.m.u0(recyclerView, bVar.b, bVar.d, bVar.c);
        } else if (i == 8) {
            recyclerView = this.a;
            recyclerView.m.r0(recyclerView, bVar.b, bVar.d, 1);
        }
    }

    public z b(int i) {
        RecyclerView recyclerView = this.a;
        int h = recyclerView.e.h();
        z zVar = null;
        for (int i2 = 0; i2 < h; i2++) {
            z L = RecyclerView.L(recyclerView.e.g(i2));
            if (!(L == null || L.m() || L.c != i)) {
                if (!recyclerView.e.k(L.a)) {
                    zVar = L;
                    break;
                }
                zVar = L;
            }
        }
        if (zVar == null || this.a.e.k(zVar.a)) {
            return null;
        }
        return zVar;
    }

    public void c(int i, int i2, Object obj) {
        int i3;
        RecyclerView recyclerView = this.a;
        int h = recyclerView.e.h();
        i2 += i;
        for (i3 = 0; i3 < h; i3++) {
            View g = recyclerView.e.g(i3);
            z L = RecyclerView.L(g);
            if (!(L == null || L.u())) {
                int i4 = L.c;
                if (i4 >= i && i4 < i2) {
                    L.b(2);
                    L.a(obj);
                    ((LayoutParams) g.getLayoutParams()).c = true;
                }
            }
        }
        s sVar = recyclerView.b;
        int size = sVar.c.size();
        while (true) {
            size--;
            if (size >= 0) {
                z zVar = (z) sVar.c.get(size);
                if (zVar != null) {
                    i3 = zVar.c;
                    if (i3 >= i && i3 < i2) {
                        zVar.b(2);
                        sVar.f(size);
                    }
                }
            } else {
                this.a.m0 = true;
                return;
            }
        }
    }

    public void d(int i, int i2) {
        int i3;
        z L;
        RecyclerView recyclerView = this.a;
        int h = recyclerView.e.h();
        int i4 = 0;
        for (i3 = 0; i3 < h; i3++) {
            L = RecyclerView.L(recyclerView.e.g(i3));
            if (!(L == null || L.u() || L.c < i)) {
                L.q(i2, false);
                recyclerView.i0.f = true;
            }
        }
        s sVar = recyclerView.b;
        i3 = sVar.c.size();
        while (i4 < i3) {
            L = (z) sVar.c.get(i4);
            if (L != null && L.c >= i) {
                L.q(i2, true);
            }
            i4++;
        }
        recyclerView.requestLayout();
        this.a.l0 = true;
    }

    public void e(int i, int i2) {
        int i3;
        int i4;
        int i5;
        int i6;
        z L;
        int i7;
        RecyclerView recyclerView = this.a;
        int h = recyclerView.e.h();
        int i8 = -1;
        if (i < i2) {
            i3 = i;
            i4 = i2;
            i5 = -1;
        } else {
            i4 = i;
            i3 = i2;
            i5 = 1;
        }
        for (i6 = 0; i6 < h; i6++) {
            L = RecyclerView.L(recyclerView.e.g(i6));
            if (L != null) {
                i7 = L.c;
                if (i7 >= i3 && i7 <= i4) {
                    if (i7 == i) {
                        L.q(i2 - i, false);
                    } else {
                        L.q(i5, false);
                    }
                    recyclerView.i0.f = true;
                }
            }
        }
        s sVar = recyclerView.b;
        if (i < i2) {
            i3 = i;
            i4 = i2;
        } else {
            i4 = i;
            i3 = i2;
            i8 = 1;
        }
        i5 = sVar.c.size();
        for (i6 = 0; i6 < i5; i6++) {
            L = (z) sVar.c.get(i6);
            if (L != null) {
                i7 = L.c;
                if (i7 >= i3 && i7 <= r5) {
                    if (i7 == i) {
                        L.q(i2 - i, false);
                    } else {
                        L.q(i8, false);
                    }
                }
            }
        }
        recyclerView.requestLayout();
        this.a.l0 = true;
    }
}
